import axios from "axios";
const mockAxios = axios.create({
    baseURL:"/mock"
})

import NProgress from "nprogress"
// 添加请求拦截器
mockAxios.interceptors.request.use(function (config) {
    //开启进度条
    NProgress.start()
    return config;
});

// 添加响应拦截器
mockAxios.interceptors.response.use(function (response) {
    //关闭进度条
    NProgress.done()
    return response.data;
}, function (error) {
    //关闭进度条
    NProgress.done()
    return Promise.reject(error);
});

export default mockAxios